import {defineConfig} from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
    srcDir: "src",
    outDir: "public",
    title: "My Notebook",
    description: "Web Full Stack",
    lastUpdated: true,
    themeConfig: {
        // https://vitepress.dev/reference/default-theme-config
        logo: '/logo.png',
        returnToTopLabel: 'Top',
        search: {
            provider: 'local'
        },
        nav: nav(),
        sidebar: {
            '/examples/': {base: '/examples/', items: sidebarExamples(), collapsed: true},
            '/server/linux/': {base: '/server/linux/', items: sidebarLinux(), collapsed: true},
            '/server/php/': {base: '/server/php/', items: sidebarPHP(), collapsed: true},
            '/tools/git/': {base: '/tools/git/', items: sidebarGit(), collapsed: true},
            '/middleware/mysql': {base: '/middleware/mysql', items: sidebarMySQL(), collapsed: true},
        },

        socialLinks: [
            {icon: 'gitee', link: 'https://gitee.com/hutaoseven/note'},
            {icon: 'github', link: 'https://github.com/hutaoseven'},
            {icon: 'vitepress', link: 'https://vitepress.dev/zh'},
        ],

        footer: {
            message: 'Released under the MIT License.',
            copyright: 'Copyright © 2015-present <a href="https://www.hutao.me">Seven</a>'
        },
    }
})


function sidebarLinux() {
    return [
        {text: 'Rsync', link: '/rsync'}
    ];
}

function sidebarExamples() {
    return [
        {text: 'Markdown Examples', link: '/markdown-examples'},
        {text: 'Runtime API Examples', link: '/api-examples'}
    ];
}

function sidebarGit() {
    return [
        {text: 'worktree', link: '/worktree'}
    ];
}
function sidebarMySQL() {
    return [
        {text: 'ForeignKey', link: '/foreignKey'}
    ];
}

function sidebarPHP() {
    return [
        {text: '安装扩展', link: '/ext'},
        {text: 'Xdebug调试', link: '/debug'}
    ];
}

function nav() {
    return [
        {text: 'Home', link: '/'},
        {text: 'Examples', link: '/examples'},
        {
            text: '前端',
            items: [
                {text: 'WebSocket', link: '/web/websocket/Reverb-protocol'},
            ]
        },
        {
            text: '后端',
            items: [
                {text: 'Linux', link: '/server/linux'},
                {text: 'PHP', link: '/server/php'},
            ]
        },
        {
            text: '中间件',
            items: [
                {text: 'Nginx', link: '/middleware/nginx'},
                {text: 'Docker', link: '/middleware/docker'},
                {text: 'MySQL', link: '/middleware/mysql'},
            ]
        },
        {
            text: '工具',
            items: [
                {text: 'Git', link: '/tools/git'},
                {text: 'SSL', link: '/tools/acme.sh'},
            ]
        },
    ];
}